<template>
  <div class="content">
    <h2>热门精选</h2>
    <div class="list">
        <template v-for="(item, index) in houselist" :key="item.data.houseId">
            <HouseListV9 v-if="item.discoveryContentType == 9" :itemData="item.data" @click="itemClick(item.data)"></HouseListV9>
            <HouseListV3 v-else-if="item.discoveryContentType == 3" :itemData="item.data" @click="itemClick(item.data)"></HouseListV3>
        </template>
    </div>
  </div>
</template>

<script setup>
import useHomeStore from "@/stores/modules/home";
import { storeToRefs } from "pinia";
import HouseListV3 from "@/components/houselist/houselist-v3.vue";
import HouseListV9 from "@/components/houselist/houselist-v9.vue";
import { useRouter } from "vue-router";



const homeStore = useHomeStore()
const { houselist } = storeToRefs(homeStore)
const router = useRouter()

const itemClick = (data) => {
  router.push("/detail/id=" + data.houseId)
}

</script>

<style lang="less" scoped>
.content {
  padding: 10px 8px;

  h2 {
    font-size: 22px;
    padding: 10px;
  }

  .list {
    display: flex;
    flex-wrap: wrap;
  }
}
</style>